import Vue from 'vue'

import '../src/css/main.css'

//导入路由的包
import VueRouter from 'vue-router'
//安装路由
Vue.use(VueRouter)
//导入自己的router.js模块
import router from './router.js'

import VueResource from 'vue-resource'
Vue.use(VueResource)

//设置请求的根路径
Vue.http.options.root = 'http://api.cms.liulongbin.top/api'
//全局设置post提交数据时的表单数据组织形式
Vue.http.options.emulateJSON = true


//导入mui样式
import './lib/mui/css/mui.min.css'
import './lib/mui/css/icons-extra.css'


//导入vue-preview插件
import VuePreview from 'vue-preview'
Vue.use(VuePreview)


//引入格式化插件moment
import moment from 'moment'
//定义全局过滤器，格式化时间
Vue.filter( 'dateFormat', function( dataStr, pattern = 'YYYY-MM-DD HH:mm:ss' ){
    return moment(dataStr).format(pattern)
})



//按需导入mintui组件
// import {Header,Swipe, SwipeItem,Button,Toast,Lazyload} from 'mint-ui'
// Vue.component(Header.name,Header)
// Vue.component(Swipe.name, Swipe)
// Vue.component(SwipeItem.name, SwipeItem)
// Vue.component(Button.name, Button)
// Vue.component(Toast)
// Vue.use(Lazyload)


//按需导入lazyload不好使，改为全部导入
import MintUI from 'mint-ui'
import 'mint-ui/lib/style.css'
Vue.use(MintUI)

//导入app根组件
import app from './App.vue'

let vm = new Vue({
    el:'#app',
    render: c => c(app),
    router//挂载路由对象到vm实例上
})